home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_qt.idb / usr / freeware / include / Qt / qfontinfo.h.z / qfontinfo.h
Encoding:
C/C++ Source or Header  |  1998-10-28  |  2.5 KB  |  95 lines

  1. /****************************************************************************
  2. ** $Id: qfontinfo.h,v 2.8 1998/07/03 00:09:33 hanord Exp $
  3. **
  4. ** Definition of QFontInfo class
  5. **
  6. ** Created : 950131
  7. **
  8. ** Copyright (C) 1992-1998 Troll Tech AS.  All rights reserved.
  9. **
  10. ** This file is part of Qt Free Edition, version 1.40.
  11. **
  12. ** See the file LICENSE included in the distribution for the usage
  13. ** and distribution terms, or http://www.troll.no/free-license.html.
  14. **
  15. ** IMPORTANT NOTE: You may NOT copy this file or any part of it into
  16. ** your own programs or libraries.
  17. **
  18. ** Please see http://www.troll.no/pricing.html for information about 
  19. ** Qt Professional Edition, which is this same library but with a
  20. ** license which allows creation of commercial/proprietary software.
  21. **
  22. *****************************************************************************/
  23.  
  24. #ifndef QFONTINFO_H
  25. #define QFONTINFO_H
  26.  
  27. #ifndef QT_H
  28. #include "qfont.h"
  29. #endif // QT_H
  30.  
  31.  
  32. class QFontInfo
  33. {
  34. public:
  35.     QFontInfo( const QFont & );
  36.     QFontInfo( const QFontInfo & );
  37.    ~QFontInfo();
  38.  
  39.     QFontInfo           &operator=( const QFontInfo & );
  40.  
  41.     const char           *family()    const;
  42.     int            pointSize()    const;
  43.     bool        italic()    const;
  44.     int            weight()    const;
  45.     bool        bold()        const;
  46.     bool        underline()    const;
  47.     bool        strikeOut()    const;
  48.     bool        fixedPitch()    const;
  49.     QFont::StyleHint    styleHint()    const;
  50.     QFont::CharSet    charSet()    const;
  51.     bool        rawMode()    const;
  52.  
  53.     bool        exactMatch()    const;
  54.  
  55. #if 1    /* OBSOLETE */
  56.     const QFont &font() const;
  57. #endif
  58.  
  59. private:
  60.     QFontInfo( const QWidget * );
  61.     QFontInfo( const QPainter * );
  62.     static void reset( const QWidget * );
  63.     static void reset( const QPainter * );
  64.     const QFontDef *spec() const;
  65.  
  66.     enum Type { FontInternal, Widget, Painter };
  67.     union {
  68.     int   flags;
  69.     void *dummy;
  70.     } t;
  71.     union {
  72.     QFontInternal *f;
  73.     QWidget          *w;
  74.     QPainter      *p;
  75.     } u;
  76.  
  77.     int        type()         const { return t.flags & 0xff; }
  78.     bool    underlineFlag()  const { return (t.flags & 0x100) != 0; }
  79.     bool    strikeOutFlag()  const { return (t.flags & 0x200) != 0; }
  80.     bool    exactMatchFlag() const { return (t.flags & 0x400) != 0; }
  81.     void    setUnderlineFlag()       { t.flags |= 0x100; }
  82.     void    setStrikeOutFlag()       { t.flags |= 0x200; }
  83.     void    setExactMatchFlag()       { t.flags |= 0x400; }
  84.  
  85.     friend class QWidget;
  86.     friend class QPainter;
  87. };
  88.  
  89.  
  90. inline bool QFontInfo::bold() const
  91. { return weight() > QFont::Normal; }
  92.  
  93.  
  94. #endif // QFONTINFO_H
  95.